const http = require('http');
const server = http.createServer();
server.on('request', (req, res) => {
    const str = `我是your request url is ${req.url},and request method is ${req.method}`;
    console.log(str);
    // 直接进行传输中文，会出现乱码问题，需要手动设置响应头
    res.setHeader('Content-type', 'text/html;charset=utf-8');
    res.end(str);
});

server.listen(80, () => {
    console.log('server running is at http://127.0.0.1');
});